package com.rwy.util;

public class RWYException extends Exception {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	

	public RWYException() {
		super();
	}
	public RWYException(String msg) {
		super(msg);
	}
	
	public static RWYException create(int code) {
		RWYException ex = null;
		switch(code) {
			case 401: 
				ex = new RWYException.AuthorizeException();
				break;
			case 400:
				ex = new RWYException.ErrorException(); 
				break;
			case 100:
				ex = new RWYException.UnAuthorizeException();
				break;
			case 101:
				ex = new RWYException.NoMobileAuthorizeException();
				break;
			default:
				ex= new RWYException();
				break;
		}
		return ex;
	}
	
	public static RWYException create(int code, String msg) {
		RWYException ex = null;
		switch(code) {
			case 401: 
				ex =new RWYException.AuthorizeException(msg);
				break;
			case 400:
				ex = new RWYException.ErrorException(msg); 
				break;
			case 100:
				ex = new RWYException.UnAuthorizeException(msg);
				break;
			case 101:
				ex = new RWYException.NoMobileAuthorizeException(msg);
				break;
			default:
				ex= new RWYException(msg);
				break;
		}
		return ex;
	}

	public static class AuthorizeException extends RWYException {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		
		public AuthorizeException() {
			super();
		}
		public AuthorizeException(String msg) {
			super(msg);
		}
		
	}
	
	public static class NoMobileAuthorizeException extends RWYException {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		
		public NoMobileAuthorizeException() {
			super();
		}
		public NoMobileAuthorizeException(String msg) {
			super(msg);
		}
		
	}
	
	public static class ErrorException extends RWYException {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		
		public ErrorException() {
			super();
		}
		public ErrorException(String msg) {
			super(msg);
		}
		
	}
	
	public static class UnAuthorizeException extends RWYException {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		
		public UnAuthorizeException() {
			super();
		}
		public UnAuthorizeException(String msg) {
			super(msg);
		}
		
	}
}
